package graphics.view;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import core.GameController;

public class KeyboardInput implements KeyListener {
	
	private GameController myController;
	
	private StringBuilder myBuffer;
	
	public KeyboardInput()
	{
		myController = GameController.getSingleton();
		myBuffer = new StringBuilder();
	}

	public void keyPressed(KeyEvent key) {
		myBuffer.append(key.getKeyChar());
		myController.trigger(myBuffer.toString());
		myBuffer.delete(0, 1);
	}

	public void keyReleased(KeyEvent key) {
		// do nothing
	}

	public void keyTyped(KeyEvent key) {
		
	}

}
